﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// Summary description for KetNoi
/// </summary>
public class KetNoi
{
    public SqlConnection connection;
    public static string str = @"Data Source=SAMSUNG-PC\SQLEXPRESS;Initial Catalog=MHPL_BanTrangSuc;Integrated Security=True";
    public KetNoi()
    {
        connection = new SqlConnection(KetNoi.str);
    }
    public void MoKN()
    {
        connection.Open();
    }
    public void DongKN()
    {
        connection.Close();
    }

    //su dung trong gio hang 
    //public int ExecuteScalar(string query)
    //{
    //    SqlConnection conn = new SqlConnection();
    //    conn.ConnectionString = str;
    //    conn.Open();
    //    SqlCommand com = new SqlCommand();
    //    com.CommandText = query;
    //    com.Connection = conn;
    //    return (int)com.ExecuteScalar();
    //}
}